package com.cxb.utils;

import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.util.Log;

/**
 * Created by Administrator on 2016/9/22.
 */
public class Tools {

    public static String getCurrentActivity(Context context) {
        ActivityManager am = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        ComponentName cn = am.getRunningTasks(1).get(0).topActivity;
        Log.e("test", "pkg:" + cn.getPackageName());
        Log.e("test", "cls:" + cn.getClassName());
        return cn.getClassName();
    }

}
